Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Collections.​Generic.​SortedSet<​T>

Assembly: System.Collections

Inheritance: object → SortedSet

Implemented Interfaces

Represents a collection of objects that is maintained in sorted order.

Properties

public IComparer<​T>
Comparer
Gets the <see cref="T:System.Collections.Generic.IComparer`1" /> object that is used to order the values in the <see cref="T:System.Collections.Generic.SortedSet`1" /> .
public int
Count
Gets the number of elements in the <see cref="T:System.Collections.Generic.SortedSet`1" /> .
public T
Max
Gets the maximum value in the <see cref="T:System.Collections.Generic.SortedSet`1" /> , as defined by the comparer.
public T
Min
Gets the minimum value in the <see cref="T:System.Collections.Generic.SortedSet`1" /> , as defined by the comparer.

Methods

public bool
Add​(T item)
Adds an element to the set and returns a value that indicates if it was successfully added.
Returns <see langword="true" /> if <paramref name="item" /> is added to the set; otherwise, <see langword="false" /> .
item The element to add to the set.
public void
Clear​()
Removes all elements from the set.
public bool
Contains​(T item)
Determines whether the set contains a specific element.
Returns <see langword="true" /> if the set contains <paramref name="item" /> ; otherwise, <see langword="false" /> .
item The element to locate in the set.
public void
CopyTo​(T[] array)
Copies the complete <see cref="T:System.Collections.Generic.SortedSet`1" /> to a compatible one-dimensional array, starting at the beginning of the target array.
array A one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.Generic.SortedSet`1" /> .
public void
CopyTo​(T[] array, int index)
Copies the complete <see cref="T:System.Collections.Generic.SortedSet`1" /> to a compatible one-dimensional array, starting at the specified array index.
array A one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.Generic.SortedSet`1" /> . The array must have zero-based indexing.
index The zero-based index in <paramref name="array" /> at which copying begins.
public void
CopyTo​(T[] array, int index, int count)
Copies a specified number of elements from <see cref="T:System.Collections.Generic.SortedSet`1" /> to a compatible one-dimensional array, starting at the specified array index.
array A one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.Generic.SortedSet`1" /> . The array must have zero-based indexing.
index The zero-based index in <paramref name="array" /> at which copying begins.
count The number of elements to copy.
public static IEqualityComparer<​SortedSet<​T>>
CreateSetComparer​()
Returns an <see cref="T:System.Collections.IEqualityComparer" /> object that can be used to create a collection that contains individual sets.
Returns A comparer for creating a collection of sets.
public static IEqualityComparer<​SortedSet<​T>>
CreateSetComparer​(IEqualityComparer?<​T> memberEqualityComparer)
Returns an <see cref="T:System.Collections.IEqualityComparer" /> object, according to a specified comparer, that can be used to create a collection that contains individual sets.
Returns A comparer for creating a collection of sets.
memberEqualityComparer The comparer to use for creating the returned comparer.
public void
ExceptWith​(IEnumerable<​T> other)
Removes all elements that are in a specified collection from the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
other The collection of items to remove from the <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
public Enumerator<​T>
GetEnumerator​()
Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.SortedSet`1" /> .
Returns An enumerator that iterates through the <see cref="T:System.Collections.Generic.SortedSet`1" /> in sorted order.
protected void
GetObjectData​(Runtime.​Serialization.​SerializationInfo info, Runtime.​Serialization.​StreamingContext context)
Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface and returns the data that you must have to serialize a <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
info A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that contains the information that is required to serialize the <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
context A <see cref="T:System.Runtime.Serialization.StreamingContext" /> structure that contains the source and destination of the serialized stream associated with the <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
public SortedSet<​T>
GetViewBetween​(T lowerValue, T upperValue)
Returns a view of a subset in a <see cref="T:System.Collections.Generic.SortedSet`1" /> .
Returns A subset view that contains only the values in the specified range.
lowerValue The lowest desired value in the view.
upperValue The highest desired value in the view.
public void
IntersectWith​(IEnumerable<​T> other)
Modifies the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object so that it contains only elements that are also in a specified collection.
other The collection to compare to the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
public bool
IsProperSubsetOf​(IEnumerable<​T> other)
Determines whether a <see cref="T:System.Collections.Generic.SortedSet`1" /> object is a proper subset of the specified collection.
Returns <see langword="true" /> if the <see cref="T:System.Collections.Generic.SortedSet`1" /> object is a proper subset of <paramref name="other" /> ; otherwise, <see langword="false" /> .
other The collection to compare to the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
public bool
IsProperSupersetOf​(IEnumerable<​T> other)
Determines whether a <see cref="T:System.Collections.Generic.SortedSet`1" /> object is a proper superset of the specified collection.
Returns <see langword="true" /> if the <see cref="T:System.Collections.Generic.SortedSet`1" /> object is a proper superset of <paramref name="other" /> ; otherwise, <see langword="false" /> .
other The collection to compare to the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
public bool
IsSubsetOf​(IEnumerable<​T> other)
Determines whether a <see cref="T:System.Collections.Generic.SortedSet`1" /> object is a subset of the specified collection.
Returns <see langword="true" /> if the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object is a subset of <paramref name="other" /> ; otherwise, <see langword="false" /> .
other The collection to compare to the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
public bool
IsSupersetOf​(IEnumerable<​T> other)
Determines whether a <see cref="T:System.Collections.Generic.SortedSet`1" /> object is a superset of the specified collection.
Returns <see langword="true" /> if the <see cref="T:System.Collections.Generic.SortedSet`1" /> object is a superset of <paramref name="other" /> ; otherwise, <see langword="false" /> .
other The collection to compare to the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
protected void
OnDeserialization​(object sender)
Implements the <see cref="T:System.Runtime.Serialization.ISerializable" /> interface, and raises the deserialization event when the deserialization is completed.
sender The source of the deserialization event.
public bool
Overlaps​(IEnumerable<​T> other)
Determines whether the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object and a specified collection share common elements.
Returns <see langword="true" /> if the <see cref="T:System.Collections.Generic.SortedSet`1" /> object and <paramref name="other" /> share at least one common element; otherwise, <see langword="false" /> .
other The collection to compare to the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
public bool
Remove​(T item)
Removes a specified item from the <see cref="T:System.Collections.Generic.SortedSet`1" /> .
Returns <see langword="true" /> if the element is found and successfully removed; otherwise, <see langword="false" /> .
item The element to remove.
public int
RemoveWhere​(Predicate<​T> match)
Removes all elements that match the conditions defined by the specified predicate from a <see cref="T:System.Collections.Generic.SortedSet`1" /> .
Returns The number of elements that were removed from the <see cref="T:System.Collections.Generic.SortedSet`1" /> collection.
match The delegate that defines the conditions of the elements to remove.
public IEnumerable<​T>
Reverse​()
Returns an <see cref="T:System.Collections.Generic.IEnumerable`1" /> that iterates over the <see cref="T:System.Collections.Generic.SortedSet`1" /> in reverse order.
Returns An enumerator that iterates over the <see cref="T:System.Collections.Generic.SortedSet`1" /> in reverse order.
public bool
SetEquals​(IEnumerable<​T> other)
Determines whether the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object and the specified collection contain the same elements.
Returns <see langword="true" /> if the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object is equal to <paramref name="other" /> ; otherwise, <see langword="false" /> .
other The collection to compare to the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
public void
SymmetricExceptWith​(IEnumerable<​T> other)
Modifies the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object so that it contains only elements that are present either in the current object or in the specified collection, but not both.
other The collection to compare to the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
public bool
TryGetValue​(T equalValue, T& actualValue)
public void
UnionWith​(IEnumerable<​T> other)
Modifies the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object so that it contains all elements that are present in either the current object or the specified collection.
other The collection to compare to the current <see cref="T:System.Collections.Generic.SortedSet`1" /> object.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object